package com.example.UI;

import android.os.Bundle;
import android.widget.ListView;

import androidx.appcompat.app.AppCompatActivity;


import com.example.UI.database.CourseMessage;
import com.example.UI.entity.Course;
import com.example.UI.list.CourseArrayAdapter;
import com.example.ui.R;

import java.util.List;

public class CourseActivity extends AppCompatActivity {
    private ListView listView;
    private CourseMessage dbHelper;
    private List<Course> courses;
    private CourseArrayAdapter courseArrayAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_student);

        dbHelper = new CourseMessage(this);
        listView = findViewById(R.id.listView);

        // 获取所有课程信息
        courses = dbHelper.getAllCourses();
        courseArrayAdapter = new CourseArrayAdapter(this, courses);
        listView.setAdapter(courseArrayAdapter);


    }

}
